Administrator Guide 2017
Dynamic Values
Dynamic Values are used to display non-fixed data on devices and reports.  magic5 has a number of methods and places in which to do this but this list deals explicitly with the ones that can be used in:
  • Device Workflow Template actions in the Value to Set prompt
  • Template Item Types, particularly Drop-down lists and General output data in the Additional display info
  • Repeating Sections within a Template for default values to be carried across
  • Quick-fill buttons for tables and sections
  • Device Template action to Update customer flag
  • Summary Form Template action Value to Set
In these areas, Dynamic Values can be used along with text to create the information required. For example, the source form that feeds into a summary form might collect the height, width and depth of an item with unique name of productH, productW and productD respectively. It may be expedient to create a single value for output onto the summary form in the format:

%@productH%(h)x%@productW%(w)x%@productD%(d) which would output (for example) 24(h)x14(w)x6(d)
There are 4 types ... there are 5 types of Dynamic Value:
  1. Result value, as shown above. This uses a previously entered value and is used in a number of areas, including repeating sections and quick-fill tables/sections. 

    Variations include:
    • %@[unique name]% which uses the value of the item on the form specified by the unique name.
    • %@[unique name]_Sequence_$current% which uses the value of the unique name as entered in the current repeating section
    • %@[unique name]_Sequence_$first% which uses the value of the unique name in the first of a set of repeating sections
    • %@[unique name]_Sequence_$last% which uses the value of the unique name in the last of a set of repeating sections
      NB the 'last' one is the one you have just created, so to reproduce the previous one, use 'penultimate'
    • %@[unique name]_Sequence_$penultimate% which uses the value of the unique name in the last-but-one of a set of repeating sections
    • %@[uniquename]:att% which uses the value of the specified attribute of the specified unique name
  2. Header information, which uses form values such as customer, location and device user in the format %$[header name]% where [header name] can be:
    • GUID: result GUID of the current form
    • CUSTOMER current customer name
    • LOCATION current location name
    • LOC current location name
    • ADDRESS current location address
    • CUSTOMERADDRESS current customer address
    • DATE date of form as YYYY-MM-DD
    • TIMESTAMP current date/time as YYYY-MM-DDTHH:MM:SS
    • WORKTIME time of form as HHMM
    • TIME current time as HHMM
    • USER current username
  3. Context-specific information, that uses the value of an item in a specific context, such as customer attribute or the output id when using device workflow actions.
    • %![tag name]% The exclamation mark (!) prefix outputs a value, often free text or numerical, and is used when the value itself is meaningful.
    • %+[tag name]% The plus sign (+) prefix outputs a description and assumes that the tag name is an id. This is used with list item attributes where a description is more meaningful than the id.
    The following areas use Context-specific Dynamic Values:
    • Additional display information (Drop-down List items and related items types)
      Each additional attribute associated with the drop-down list item will be available as a context-specific tag.  The attributes available will depend on which "additional attributes" have been specified for the list in question.  In addition, description will be a tag giving access to the list item description.
    • Additional display information (General Output Data for Customers, Locations and Users)
      Each additional attribute associated with the customer, location or user will be available as a context-specific tag.  In addition, description will be a tag giving access to the customer or location name or, in the case of users, the user's username.
    • Device Workflow - multi-forms
      In this case a new form is created for either every row in the source table or each cascading child item in a selected list entry.

      sourceId contains either the value of the column specified as the source table (using the syntax [unique name of table]:[unique name of column]), or the id of the cascading child item specified in the same box (as a unique name) - in this case %+sourceId% would probably be used to output the description rather than id.
  4. General tags, which behave similarly to Header information but are interpreted differently by magic5 to insert the fixed items listed below. 

    The syntax is %[tag name]%
    • CUSTOMER customer name
    • LOCATION location name
    • USERFULLNAME current username
    • DATE form date as YYYY-MM-DDTHH:MM:SS
    • SHORT_DATE form date as YYYY-MM-DD
    • YEAR form date as YY
    • MONTH form date as MM
    • GUID form GUID
    • CURRENT_DATE current date as YYYY-MM-DDTHH:MM:SS
    • CURRENT_SHORT_DATE current date as YYYY-MM-DD
    • CURRENT_YEAR current year as YYYY
    • CURRENT_MONTH current month as YYYY-MM
    • APP_VERSION version of the app (eg 6.116.615.2)
    • YY form year as YY
    • MM form month as MM
    • DD form date as DD
    • CURRENT_YY current year as YY
    • CURRENT_MM current month as MM
    • CURRENT_DD current date as DD
    • NEW_LINE new line character to allow a new line of text to be started (ie 'carriage return')
    • DEFAULT_EMAIL_FROM_ADDRESS default used by magic5 when setting up a new e-mail
    • DEFAULT_EMAIL_TO_ADDRESS default used by magic5 when setting up a new e-mail
  5. Tables which are largely used in Additional display items tab in a drop-down (or similar) Template Item
    The format is something like the following - be very aware of semi-colons and colons and that the correct number are included.

    %$TablePrintX:[attributeTableName]:[attributeRow]:[firstItemHeading];[firstItemColumnSize];[firstItemAttributName];[firstItemFormat];[second ....];[third ...];[...];%

    eg %$TablePrintX:Temps:Temp:Date;-10;date;displayDate;Min;10;min;;Max;10;max;;Hot;10;hotInlet;;Cold;10;coldInlet;%

    where the list item xml is ...
    <ListItem cwSource="Test" brand="Tesco" showerType="255001" showerMaterial="255003" loc="Bathroom" aType="261020" hwSource="Test" inService="261292" statusCondition="261295" compliance="261298" cws="261028" hws="261029">
    <Temps>
     <Temp idGuid="983a21a1-0941-4f08-9bfc-c469d638f54e" date="2021-06-04T18:06:08" max="100" hotInlet="N/A" coldInlet="N/A" roseId="253284" rose="Satisfactory"/>
     </Temps>
    </ListItem>
See Also